import PubSub from 'pubsub-js'
import { PUBSUB_REQUEST } from '@/constants/pubsub'

export function pubsubHandler(router: any) {
  PubSub.subscribe(PUBSUB_REQUEST.noPermissionCode, (msg, data) => {
    router.push({ path: '/404' })
  })
  PubSub.subscribe(PUBSUB_REQUEST.invalidCode, (msg, data) => {
    router.push({ path: '/login' })
  })
}
